package com.cqrcb.cloud.utils;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * @author ：29520
 * @date ：Created in 2021/8/4 19:53
 * @description：
 * @modified By：
 * @version:
 */
public class FileUtil {
    public static void search(List<String> files, File fn) {
        if(fn.isFile()) {
            files.add(fn.getAbsolutePath());
        }else if(fn.isDirectory()) {
            File[] filistD = fn.listFiles();
            for(File f: filistD) {
                search(files, f);
            }
        }
    }

    public static void main(String[] args) {
        ArrayList<String> files = new ArrayList<>();
        File file = new File("D:/tmp");
        search(files,file);
        for(String f : files){
            System.out.println(f);
        }
    }
}
